package 缓存工具;

import java.util.concurrent.TimeUnit;

public class 缓存工具
{
    public static void main(String[] args) throws InterruptedException
    {

        User user = new User("hwm",23);

        CacheManager.put("user_123", user, 1); // 缓存5分钟
        //Thread.sleep(1000);
        User cachedUser = CacheManager.get("user_123", User.class);
        System.out.println(cachedUser);
    }
}
class User{
    String name;
    int age;

    @Override
    public String toString()
    {
        return "User{" + "name='" + name + '\'' + ", age=" + age + '}';
    }

    User(String name, int age){
        this.age=age;
        this.name=name;
    }
}
